From: Jan Beulich Date: Fri, 19 Jan 2018 10:09:55 +0000 (+0100) Subject: x86/HVM: make explicit that hvm_print_line() does output only X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~736 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=75c47ae9b63483ac404ea7e4a28cb5fb1d989ef8;p=xen.git x86/HVM: make explicit that hvm_print_line() does output only On input "c" being 0xff should already have the effect of bailing early (due to the isprint()), but let's rather make this explicit. Also convert the BUG_ON() to an ASSERT() (nothing fatal happens in the function if this is violated), at the same time extending what is being checked. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index db282b55d9..cee2385a60 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -544,7 +544,11 @@ static int hvm_print_line( struct domain *cd = current->domain; char c = *val; - BUG_ON(bytes != 1); + ASSERT(bytes == 1 && port == 0xe9); + + /* Deny any input requests. */ + if ( dir != IOREQ_WRITE ) + return X86EMUL_UNHANDLEABLE; /* Accept only printable characters, newline, and horizontal tab. */ if ( !isprint(c) && (c != '\n') && (c != '\t') )